// JavaScript Document
						
$(function() {
	//images loaded
	$("img").imagesLoaded({
		progress: function (isBroken, $images, $proper, $broken) {
			$(this).fadeTo("medium", 1);
		},
		always: function() {
			$("img").css("opacity", 1);
		}
	});
	
	//window resize
	$(window).resize(onResize).trigger("resize");
	
	function onResize(){	
		//var dS = $('.navigation li.active').attr('data-slide');
		//dataslide = $('.navigation li.active').attr('data-slide');		
		
		var wWidth = $(window).width();
		var wHeight = $(window).height();
		var formatW = wWidth / 16 ;
		var formatH = wHeight / 9 ;
		var pantSize =  formatW/formatH;
		
		$('.slide').not(".static").css({
			height:wHeight+8,
			width:wWidth
		});
		
		if(wWidth <= 1200) $("div.cabecera").css("width", "96%");		
		else $("div.cabecera").css("width", "");
		
		//console.log(pantSize);
		
		if(pantSize > 1.5)
		{
			$('img.background').css({
				height:wHeight,
				width:wHeight*1.8
			});
		}else{
				$('img.background').css({
					height:wWidth*0.7,
					width:wWidth*1.2
				});
			}
		
		/*if($(window).width() <= 1280  ){
		
			$('img.background').css({
			//height:$(window).width(),
			width:$(window).width()
			});
			
		console.log($(window).width());
		
		}else 
		{
			 
			$('img.background').css({
			//height:$(window).height()*0.95,
			width:$(window).width()*1.2
			});
		}*/
	}
});